UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'f/T2QK6HUuS9wW0zv6Wpp6nBycqZUbBIh5DTPLRfr1M=' 
WHERE 
  key_id = '0ce38dcb850f4fd59473f199d18e631e9d9002d88ac136e09838bba561e0891b' 
  AND (
    token = 'f/T2QK6HUuS9wW0zv6Wpp6nBycqZUbBIh5DTPLRfr1M=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00024