UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'JMul3fkad7E4TLYiJpP78tveDfB/r2p1/ECpzbiI+7w=' 
WHERE 
  key_id = '1d51499ebb19c218f4ea784b07ca74826628762b6d77f9e1ae028b6d791af8bb' 
  AND (
    token = 'JMul3fkad7E4TLYiJpP78tveDfB/r2p1/ECpzbiI+7w=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00021