UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HYQb9rEy39ShLVHacufUkPnIYO3yKDuQUYuNSk9Hjx8=' 
WHERE 
  key_id = '3a5083646a2aac467daaa8143f6d92f0ef46345ca9d2313357944ccafbaf4ad2' 
  AND (
    token = 'HYQb9rEy39ShLVHacufUkPnIYO3yKDuQUYuNSk9Hjx8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00012