UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KNHFzUWBy33TW8IaHa6VXm8pzfX/Sl3rWQ6EaUc7xUU=' 
WHERE 
  key_id = 'c209cf202806750a26fd2f15a6c776b0fa7d90519aa50efd504e78e6f05100dc' 
  AND (
    token = 'KNHFzUWBy33TW8IaHa6VXm8pzfX/Sl3rWQ6EaUc7xUU=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00023