UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7w8+PddnaQ5RobQT46UB13PKHOPw5T+wYgMQ79rh6Dc=' 
WHERE 
  key_id = '42a878271ee1f30e178122d9069a888542056e2ab66068597f22c075b49d2165' 
  AND (
    token = '7w8+PddnaQ5RobQT46UB13PKHOPw5T+wYgMQ79rh6Dc=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00033