UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'wfWROoCNwhmWpwMygXp0pjHIt8Xl+hHXgLX9KAosZc8=' 
WHERE 
  key_id = 'd2d73a15f80a7386496258f0390ce0b22b79a6e84c3da2c099ff017ec5d87a99' 
  AND (
    token = 'wfWROoCNwhmWpwMygXp0pjHIt8Xl+hHXgLX9KAosZc8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00052