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

Query time 0.00022