UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '45wC56wIcipe8UviCCG0KnRQ654Rat/TeVa3ZgOYksA=' 
WHERE 
  key_id = '974cc343386f4e2c55117735f2087f224b6691d65bf75dfa749421e681f44d89' 
  AND (
    token = '45wC56wIcipe8UviCCG0KnRQ654Rat/TeVa3ZgOYksA=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00040