UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'DhSNcvhrGtH+He0JxLstCW+zBW6nRWtNjrG9Ve+Qzas=' 
WHERE 
  key_id = '7a0953d66d63f172a97aa1c5cb08200ab8cf4d1e9d800ad97f790dbde7c0b288' 
  AND (
    token = 'DhSNcvhrGtH+He0JxLstCW+zBW6nRWtNjrG9Ve+Qzas=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00032