UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '4PMRESpSWNGVbBn0oMadsDT8fj6JGSuHkwSyYESRZ/s=' 
WHERE 
  key_id = 'b9f33999062145b3c215f2975a9f788aa41fc3176425bc9ccb2158b379318c46' 
  AND (
    token = '4PMRESpSWNGVbBn0oMadsDT8fj6JGSuHkwSyYESRZ/s=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034