UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'vxu9DFstx0lziVMw4WTgGlIA0FPyVFz650RFRYQuNDc=' 
WHERE 
  key_id = 'd663cc3dc87c3f856edbdd9d56629a871910fc60917e6788305940013c2398eb' 
  AND (
    token = 'vxu9DFstx0lziVMw4WTgGlIA0FPyVFz650RFRYQuNDc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00125