UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YNVOH9E6//E3xskEAtnl6irEuzapu0zKZPdU05jL9XE=' 
WHERE 
  key_id = 'ae639dc2bc67178af66828de4873ce0b77694a775d15e8581fd8af9a9d4cc846' 
  AND (
    token = 'YNVOH9E6//E3xskEAtnl6irEuzapu0zKZPdU05jL9XE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032