UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = 'qTTfT26r85opt3IunTOBfJ9cJU9ZAbyqiR55uQFOlDw=' 
WHERE 
  key_id = '2a85c716c74e0a789deef7b556eb15e6677b85672fce16bfdabc04062d2adcee' 
  AND (
    token = 'qTTfT26r85opt3IunTOBfJ9cJU9ZAbyqiR55uQFOlDw=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00026