UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'XLF5+RoS8l/CKIctvA3VcOeXUUys7gynPIZ+vTLkMzE=' 
WHERE 
  key_id = '0eefa56234cce2f998e72f1c2622b25d22df602940f0701e373d6cf9574b6cb3' 
  AND (
    token = 'XLF5+RoS8l/CKIctvA3VcOeXUUys7gynPIZ+vTLkMzE=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034