UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'h3iqH2vE8FgCUrnOclz/ABvtiD7jvwSWogUpqSq+n8w=' 
WHERE 
  key_id = 'ce348676b0ee9b3dd72dc259e7d29a95d6a6ac58b5c7810afab77c8c95002837' 
  AND (
    token = 'h3iqH2vE8FgCUrnOclz/ABvtiD7jvwSWogUpqSq+n8w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00036