UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'daetiRZOVNSYedRBLZFxFld4+ZlPljCCs/kv/LWcZcc=' 
WHERE 
  key_id = '3d7f223a467f8aa66a0748745782a194b9e763511542e47be8390129516d246d' 
  AND (
    token = 'daetiRZOVNSYedRBLZFxFld4+ZlPljCCs/kv/LWcZcc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026