UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xSYqUcSRRU480P9pVH7nft3qrtrxLzEtDIEakz9Qo3A=' 
WHERE 
  key_id = '5c65d5c577f47c1c8c11734e3665f67a6c6a580909bf782c58d5e9a1d1c7f046' 
  AND (
    token = 'xSYqUcSRRU480P9pVH7nft3qrtrxLzEtDIEakz9Qo3A=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00025