UPDATE 
  cscart_lock_keys 
SET 
  expiry_at = UNIX_TIMESTAMP(NOW()) + 30, 
  token = '7HcESDIGFu0nwEZju/rKh1OgQQswCgWDHVBLzBRgsa4=' 
WHERE 
  key_id = 'f402f13d6d0c50ff05ced311d884a14fb19cdb422769d06313c16c7218c48ee7' 
  AND (
    token = '7HcESDIGFu0nwEZju/rKh1OgQQswCgWDHVBLzBRgsa4=' 
    OR expiry_at <= UNIX_TIMESTAMP(NOW())
  )

Query time 0.00034