UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'YmMX/3n69pJJk0o0IGlDscHtbCVif2I7KXUAoJPpfgc=' 
WHERE 
  key_id = '39e80261d7708345d15db2da16c6dfac2e5f5697448138ef2202a7376ab7eb82' 
  AND (
    token = 'YmMX/3n69pJJk0o0IGlDscHtbCVif2I7KXUAoJPpfgc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00046