UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'bawuMaQ+gsSKw6dv/x1fvuaBMQMl3EFin2/oDzHoin8=' 
WHERE 
  key_id = '4002f826097d1fb520ed81b393d66702e8c146045b69b356c00c615621c9e5d3' 
  AND (
    token = 'bawuMaQ+gsSKw6dv/x1fvuaBMQMl3EFin2/oDzHoin8=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00044