UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'Q0LfB8yOwS9on8/hGpka2bvpUIfZNYt/hMgcun2UMZ0=' 
WHERE 
  key_id = '418152fb676a2c36830c2e359fbc02b3aa9b94cbd0e8a5e718cbf12ecbb631fc' 
  AND (
    token = 'Q0LfB8yOwS9on8/hGpka2bvpUIfZNYt/hMgcun2UMZ0=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00028