UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'xbyn51ZGcLAavNmLejKme+ruU9c3H0XjawIqrdYmHrQ=' 
WHERE 
  key_id = 'c694252f663a2994dbc605bc8dd8979f602ce5b213e5f7f24b8d83eb9f453411' 
  AND (
    token = 'xbyn51ZGcLAavNmLejKme+ruU9c3H0XjawIqrdYmHrQ=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028