UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'VFE/RJDs5b5hRPmPQWSB24//IMP+vcMEowya1mUpPQE=' 
WHERE 
  key_id = 'f9f038bd430ea726a8393137d1b8561ad35f279d85f7dd874beb9879970c7163' 
  AND (
    token = 'VFE/RJDs5b5hRPmPQWSB24//IMP+vcMEowya1mUpPQE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00027