UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'HtHZsSCTFtEWc26pTfqouLNdJzpAwvivzHjZbrA+k28=' 
WHERE 
  key_id = '7a668a58a231ab9ddd29b346fb34cd1c1149fc69b62c939ce5f51a1bece598b9' 
  AND (
    token = 'HtHZsSCTFtEWc26pTfqouLNdJzpAwvivzHjZbrA+k28=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00030