UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '03ooxn/CvvsC8QBm23piBy0y6JJVkkT36LA6k4YavuY=' 
WHERE 
  key_id = 'b31c295b67af9a13cda09e126063dbef9f245eb1b749d219904f92d62bd320d5' 
  AND (
    token = '03ooxn/CvvsC8QBm23piBy0y6JJVkkT36LA6k4YavuY=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040