UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'KDx88s5/I/umQNK6fcaqK/2LFYPPICNHajklqVGsWxA=' 
WHERE 
  key_id = '70be1fcf0005229f751126e4c3e90d9bca50f35cffb166606be77b7cc5ffc334' 
  AND (
    token = 'KDx88s5/I/umQNK6fcaqK/2LFYPPICNHajklqVGsWxA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00035