UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'dPz/zKPoKYkba3rR/hYB3ti4yHFf3CJWKJ1MqOGJfuQ=' 
WHERE 
  key_id = 'a4e6cdb6fd0d83d323e03a02e670ec4438316342308e08895c848092c1503e97' 
  AND (
    token = 'dPz/zKPoKYkba3rR/hYB3ti4yHFf3CJWKJ1MqOGJfuQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00039