UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'hNaWF5P2o1v9zdn6/BHAuSMxIEUwghVO7VvioxAgo2Q=' 
WHERE 
  key_id = '7f7a74d2f28eab0b93331d9574151d521cbe7a755ec3e17e5b78d44cbb127eb1' 
  AND (
    token = 'hNaWF5P2o1v9zdn6/BHAuSMxIEUwghVO7VvioxAgo2Q=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033