UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'iNUUXftktTze9G7RJ/lTI1PTXx188zQVjJcoOteEe7E=' 
WHERE 
  key_id = '5328fbeca02d213bf5e59d59039e2426c59513c8fa9bcd6a70d54fbf6ddf7586' 
  AND (
    token = 'iNUUXftktTze9G7RJ/lTI1PTXx188zQVjJcoOteEe7E=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026